# Contributor: Michael Mason <ms13sp@gmail.com>
# Maintainer: Michael Mason <ms13sp@gmail.com>
pkgname=freetds
pkgver=1.2.3
pkgrel=0
pkgdesc="Tabular Datastream Library"
url="https://www.freetds.org/"
arch="all"
license="GPL-2.0-or-later OR LGPL-2.0-or-later"
makedepends="openssl-dev linux-headers readline-dev unixodbc-dev"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc"
source="https://www.freetds.org/files/stable/freetds-$pkgver.tar.bz2
	fix-includes.patch
	"
options="!check"  # tests require running SQL server http://www.freetds.org/userguide/confirminstall.htm#TESTS

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--enable-msdblib \
		--with-openssl=/usr \
		--enable-odbc \
		--with-unixodbc=/usr
	make
}

check() {
	cd "$builddir"/src/replacements
	make check
}

package() {
	make -j1 DESTDIR="$pkgdir" install
}

sha512sums="eb048633a9549c0d78d34cde4ecdb5bb6ca0cb3aa06e53ec38e19f5a452a6afa729de4fee44c4fbc77cb868afb390abf3f6193d058cabcb5341380fdc68f8d4d  freetds-1.2.3.tar.bz2
9ca126d9316cf48fa5f9572b5aa9122eb114033627ab75f6715bce0260d70c6a7bb8a71ecb1e209a4f83416332d10942c7aaf02a5249948cf1cec6a1a457a236  fix-includes.patch"
